Skip to content

feat: validate model params at runtime#64

Merged
brunobuddy merged 1 commit into
mainfrom
feat/runtime-param-validation
Jun 9, 2026
Merged

feat: validate model params at runtime#64
brunobuddy merged 1 commit into
mainfrom
feat/runtime-param-validation

Conversation

@brunobuddy

Copy link
Copy Markdown
Member

💭 Why

ParamsOf<Id> only types params known at compile time. An HTTP request body is any, so server-side callers had to hand-roll the range and enum checks the catalog already encodes.

✨ What changed

  • parseParams(id, input) validates an untrusted params object: unknown keys, numeric ranges, enum values.
  • paramsSchema(id) returns a Standard Schema, so it drops into tRPC, Hono, and similar.
  • Export a loose Param type; getModel(id).params assigns to readonly Param[] with no cast.
  • 12 runtime tests + type-level assertions; README documented.

👤 For users

Validate request params against a model's catalog in one call instead of a bespoke validator.

🔧 For operators

Code-only change, so it won't auto-publish (the release pipeline triggers on catalog edits). Run the "Release modelparams" workflow with force_level=patch to ship it.

ParamsOf<Id> only types params known at compile time; an HTTP body is `any`. parseParams(id, input) validates an untrusted params object against the catalog (unknown keys, numeric ranges, enum values), and paramsSchema(id) exposes the same as a Standard Schema for tRPC/Hono/etc. Also exports a loose `Param` type that getModel(id).params assigns to without a cast.
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
modelparams.dev Ready Ready Preview Jun 9, 2026 11:13am

Request Review

@brunobuddy brunobuddy merged commit 0a285a7 into main Jun 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant